home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / libselinux1.postinst < prev    next >
Encoding:
Text File  |  2010-07-21  |  8.1 KB  |  237 lines

  1. #! /bin/sh
  2. #                           -*- Mode: Sh -*-
  3. # postinst ---
  4. # Author           : Manoj Srivastava ( srivasta@glaurung.green-gryphon.com )
  5. # Created On       : Fri Nov 14 11:25:07 2003
  6. # Created On Node  : glaurung.green-gryphon.com
  7. # Last Modified By : Manoj Srivastava
  8. # Last Modified On : Tue Oct 26 03:31:54 2004
  9. # Last Machine Used: glaurung.internal.golden-gryphon.com
  10. # Update Count     : 13
  11. # Status           : Unknown, Use with caution!
  12. # HISTORY          :
  13. # Description      :
  14. #
  15. # arch-tag: 5401e9ef-39cc-4aee-96a4-61dfb8f32cf7
  16. #
  17. # This program is free software; you can redistribute it and/or modify
  18. # it under the terms of the GNU General Public License as published by
  19. # the Free Software Foundation; either version 2 of the License, or
  20. # (at your option) any later version.
  21. #
  22. # This program is distributed in the hope that it will be useful,
  23. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25. # GNU General Public License for more details.
  26. #
  27. # You should have received a copy of the GNU General Public License
  28. # along with this program; if not, write to the Free Software
  29. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  30. #
  31. #
  32.  
  33. # Abort if any command returns an error value
  34. set -e
  35.  
  36. package_name=libselinux1
  37.  
  38. if [ -z "$package_name" ]; then
  39.     print >&2 "Internal Error. Please report a bug."
  40.     exit 1;
  41. fi
  42.  
  43. # This script is called as the last step of the installation of the
  44. # package.  All the package's files are in place, dpkg has already done
  45. # its automatic conffile handling, and all the packages we depend of
  46. # are already fully installed and configured.
  47. # summary of how this script can be called:
  48. #        * <postinst> `configure' <most-recently-configured-version>
  49. #        * <old-postinst> `abort-upgrade' <new version>
  50. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  51. #          <new-version>
  52. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  53. #          <failed-install-package> <version> `removing'
  54. #          <conflicting-package> <version>
  55. # for details, see http://www.debian.org/doc/debian-policy/ or
  56. # the debian-policy package
  57. #
  58. # quoting from the policy:
  59. #     Any necessary prompting should almost always be confined to the
  60. #     post-installation script, and should be protected with a conditional
  61. #     so that unnecessary prompting doesn't happen if a package's
  62. #     installation fails and the `postinst' is called with `abort-upgrade',
  63. #     `abort-remove' or `abort-deconfigure'.
  64.  
  65. # The following idempotent stuff doesn't generally need protecting
  66. # against being run in the abort-* cases.
  67.  
  68. # Create stub directories under /usr/local
  69. ##: if test ! -d /usr/local/lib/${package_name}; then
  70. ##:   if test ! -d /usr/local/lib; then
  71. ##:     if mkdir /usr/local/lib; then
  72. ##:       chown root.staff /usr/local/lib || true
  73. ##:       chmod 2775 /usr/local/lib || true
  74. ##:     fi
  75. ##:   fi
  76. ##:   if mkdir /usr/local/lib/${package_name}; then
  77. ##:     chown root.staff /usr/local/lib/${package_name} || true
  78. ##:     chmod 2775 /usr/local/lib/${package_name} || true
  79. ##:   fi
  80. ##: fi
  81.  
  82. # Ensure the menu system is updated
  83. ##: [ ! -x /usr/bin/update-menus ] || /usr/bin/update-menus
  84.  
  85. # Arrange for a daemon to be started at system boot time
  86. ##: update-rc.d ${package_name} default >/dev/null
  87.  
  88. case "$1" in
  89.   configure)
  90.     # Configure this package.  If the package must prompt the user for
  91.     # information, do it here.
  92.     # Install emacs lisp files
  93.     ##:if [ -x  /usr/lib/emacsen-common/emacs-package-install ]; then
  94.     ##:    /usr/lib/emacsen-common/emacs-package-install $package_name
  95.     ##:fi
  96.  
  97.  
  98.     # Activate menu-methods script
  99.     ##: chmod a+x /etc/menu-methods/${package_name}
  100.  
  101.     # Update ld.so cache
  102.     ldconfig
  103.  
  104.     # Make our version of a program available
  105.     ##: update-alternatives \
  106.     ##:       --install /usr/bin/program program /usr/bin/alternative 50 \
  107.     ##:       --slave /usr/man/man1/program.1.gz program.1.gz \
  108.     ##:               /usr/man/man1/alternative.1.gz
  109.  
  110.     # Tell ucf that the file in /usr/share/foo is the latest
  111.     # maintainer version, and let it handle how to manage the real
  112.     # confuguration file in /etc. This is how a static configuration
  113.     # file can be handled:
  114.     ##:if which ucf >/dev/null 2>&1; then
  115.     ##:  ucf /usr/share/${package_name}/configuration /etc/${package_name}.conf
  116.     ##:fi
  117.  
  118.     ### We could also do this on the fly. The following is from Tore
  119.     ### Anderson:
  120.  
  121.     #. /usr/share/debconf/confmodule
  122.  
  123.     ### find out what the user answered.
  124.     #  db_get foo/run_on_boot
  125.     #  run_on_boot=$RET
  126.     #  db_stop
  127.  
  128.     ### safely create a temporary file to generate our suggested
  129.     ### configuration file.
  130.     #    tempfile=`tempfile`
  131.     #    cat << _eof > $tempfile
  132.     ### Configuration file for Foo.
  133.  
  134.     ### this was answered by you, the user in a debconf dialogue
  135.     #  RUNONBOOT=$run_on_boot
  136.  
  137.     ### this was not, as it has a sane default value.
  138.     #  COLOUROFSKY=blue
  139.  
  140.     #_eof
  141.  
  142.     ### Note that some versions of debconf do not release stdin, so
  143.     ### the following invocation of ucf may not work, since the stdin
  144.     ### is never coneected to ucfr.
  145.  
  146.     ### now, invoke ucf, which will take care of the rest, and ask
  147.     ### the user if he wants to update his file, if it is modified.
  148.     #ucf $tempfile /etc/foo.conf
  149.  
  150.     ### done! now we'll just clear up our cruft.
  151.     #rm -f $tempfile
  152.  
  153.     if [ -x /sbin/init ] && [ -d /proc/1 ] &&
  154.         [ "$(stat -c %d/%i /sbin/init)" = "$(stat -Lc %d/%i /proc/1/exe 2>/dev/null)" ] ; then
  155.         # So, init exists, and there is a linuxy /proc, and the inode of the executable
  156.         # of the process with pid 1 is the same as /sbin/init (ok, no init=/bin/sh going on)
  157.  
  158.         if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
  159.             # the devicenumber/inode pair of / is the same as that of
  160.             # /sbin/init's root, so we're *not* in a chroot
  161.  
  162.             # Final sanity check. Make sure there is a /dev/initctl
  163.             # for us to talk to
  164.             if [ -e /dev/initctl ]; then
  165.                 # Use telinit if available, it is better form, according
  166.                 # to the sysvinit maintainer.
  167.                 if [ -x /sbin/telinit ]; then
  168.                     (telinit u ; sleep 1)
  169.                 else
  170.                     (init u ; sleep 1)
  171.                 fi
  172.             fi
  173.         fi
  174.     fi
  175.  
  176.  
  177.  
  178.     # There are three sub-cases:
  179.     if test "${2+set}" != set; then
  180.       # We're being installed by an ancient dpkg which doesn't remember
  181.       # which version was most recently configured, or even whether
  182.       # there is a most recently configured version.
  183.       :
  184.  
  185.     elif test -z "$2" || test "$2" = "<unknown>"; then
  186.       # The package has not ever been configured on this system, or was
  187.       # purged since it was last configured.
  188.       :
  189.  
  190.     else
  191.       # Version $2 is the most recently configured version of this
  192.       # package.
  193.       :
  194.  
  195.     fi ;;
  196.   abort-upgrade)
  197.     # Back out of an attempt to upgrade this package FROM THIS VERSION
  198.     # to version $2.  Undo the effects of "prerm upgrade $2".
  199.     :
  200.  
  201.     ;;
  202.   abort-remove)
  203.     if test "$2" != in-favour; then
  204.       echo "$0: undocumented call to \`postinst $*'" 1>&2
  205.       exit 0
  206.     fi
  207.     # Back out of an attempt to remove this package, which was due to
  208.     # a conflict with package $3 (version $4).  Undo the effects of
  209.     # "prerm remove in-favour $3 $4".
  210.     :
  211.  
  212.     ;;
  213.   abort-deconfigure)
  214.     if test "$2" != in-favour || test "$5" != removing; then
  215.       echo "$0: undocumented call to \`postinst $*'" 1>&2
  216.       exit 0
  217.     fi
  218.     # Back out of an attempt to deconfigure this package, which was
  219.     # due to package $6 (version $7) which we depend on being removed
  220.     # to make way for package $3 (version $4).  Undo the effects of
  221.     # "prerm deconfigure in-favour $3 $4 removing $6 $7".
  222.     :
  223.  
  224.     ;;
  225.   *) echo "$0: didn't understand being called with \`$1'" 1>&2
  226.      exit 0;;
  227. esac
  228.  
  229. # Install doc base documentation
  230. ##:if which install-docs >/dev/null 2>&1; then
  231. ##:  if [ -e /usr/share/doc-base/${package_name} ]; then
  232. ##:    install-docs -i /usr/share/doc-base/${package_name}
  233. ##:  fi
  234. ##:fi
  235.  
  236. exit 0
  237.